/*
 * Inventory.java
 *
 * Created on October 14, 2002, 4:48 PM
 * This object is using to show the Order Scheduling
 */

package com.scalar.chiptrack.operations;

import java.util.ArrayList;

/**
 *
 * @author  kumar
 */
public class Inventory {
    
    private String processType = null;
    private int goodUnits = 0;
    private int holdUnits = 0;
    private int week1 = 0;
    private int week2 = 0;
    private int week3 = 0;
    private int week4 = 0;
    private int week5 = 0;
    private int week6 = 0;
    private int week7 = 0;
    private int week8 = 0;
    private int week9 = 0;
    private int week10 = 0;
    private int week11 = 0;
    private int week12 = 0;
    private int week13 = 0;
    
    /** Creates a new instance of Inventory */
    public Inventory() {
    }
    
    public String getProcessType()
    {
        return processType;
    }
    
    public void setProcessType(String processType)
    {
        this.processType = processType;
    }
    
    public int getGoodUnits()
    {
        return goodUnits;
    }
    
    public void setGoodUnits(int goodUnits)
    {
        this.goodUnits = goodUnits;
    }
    
    public int getHoldUnits()
    {
        return holdUnits;
    }
    
    public void setHoldUnits(int holdUnits)
    {
        this.holdUnits = holdUnits;
    }
    
    public Inventory(int week1, int week2, int week3, int week4, int week5, int week6,
                        int week7, int week8, int week9, int week10, int week11, int week12, int week13)
    {
        this.week1 = week1;
        this.week2 = week2;
        this.week3 = week3;
        this.week4 = week4;
        this.week5 = week5;
        this.week6 = week6;
        this.week7 = week7;
        this.week8 = week8;
        this.week9 = week9;
        this.week10 = week10;
        this.week11 = week11;
        this.week12 = week12;
        this.week13 = week13;
        
    }
    
    // Added by Balaram Putta
    public int getQtyByWeek (int weekNumber) 
    {
        switch (weekNumber) {
            case 1:
                return this.week1;
                
            case 2:
                return this.week2;
                
            case 3:
                return this.week3;
                
            case 4:
                return this.week4;
                
            case 5:
                return this.week5;
                
            case 6:
                return this.week6;
                
            case 7:
                return this.week7;
                
            case 8:
                return this.week8;
                
            case 9:
                return this.week9;
                
            case 10:
                return this.week10;
                
            case 11:
                return this.week11;
                
            case 12:
                return this.week12;
                
            case 13:
                return this.week13;
                
            default:
                return 0;
        }
    }
    
    // Added by Balaram Putta
    public void setQtyByWeek (String weekNumber, String quantity) {
        
        int week = -1;
        int qty = -1;
        
        try {
            week = Integer.parseInt (weekNumber);
            qty = Integer.parseInt (quantity);
            
            setQtyByWeek (week, qty);
        }
        catch (NumberFormatException nfe) {
            // possibly a null weekNumber
        }
    }

    // Added by Balaram Putta
    public void setQtyByWeek (String weekNumber, int qty) {
        int week = -1;
        try {
            week = Integer.parseInt(weekNumber);
            setQtyByWeek (week, qty);
        }
        catch (NumberFormatException nfe) {
            // possibly a null weekNumber
        }
    }

    
    // Added by Balaram Putta
    public Inventory getDelta (Inventory inv) {
        
        Inventory deltaInventory = new Inventory();
        
        for (int i=1; i<=13; i++) {
            deltaInventory.setQtyByWeek (i, (this.getQtyByWeek(i) - inv.getQtyByWeek(i)));
        }
        
        return deltaInventory;
    }
    
    
    // Added by Balaram Putta
    public Inventory getCumulative() {
        
        Inventory cumulativeInventory = new Inventory();
        int totalQty = 0;
        
        for (int i=1; i<=13; i++) {
            totalQty = totalQty + this.getQtyByWeek(i);
            cumulativeInventory.setQtyByWeek(i, totalQty);
        }
        
        return cumulativeInventory;
    }
    
    
    // Added by Balaram Putta
    public void setQtyByWeek (int weekNumber, int qty) 
    {
        
        switch (weekNumber) {
            
            case 1:
                this.week1 = qty;
                break;
                
            case 2:
                this.week2 = qty;
                break;
                
            case 3:
                this.week3 = qty;
                break;
                
            case 4:
                this.week4 = qty;
                break;
                
            case 5:
                this.week5 = qty;
                break;
                
            case 6:
                this.week6 = qty;
                break;
                
            case 7:
                this.week7 = qty;
                break;
                
            case 8:
                this.week8 = qty;
                break;
                
            case 9:
                this.week9 = qty;
                break;
                
            case 10:
                this.week10 = qty;
                break;
                
            case 11:
                this.week11 = qty;
                break;
                
            case 12:
                this.week12 = qty;
                break;
                
            case 13:
                this.week13 = qty;
                break;
                
            default:
                break;

        }
        
    }
    

    
    public int getWeek1()
    {
        return week1;
    }
    
    public void setWeek1(int week1)
    {
        this.week1 = week1;
    }
    public int getWeek2()
    {
        return week2;
    }
    
    public void setWeek2(int week2)
    {
        this.week2 = week2;
    }
    public int getWeek3()
    {
        return week3;
    }
    
    public void setWeek3(int week3)
    {
        this.week3 = week3;
    }
    public int getWeek4()
    {
        return week4;
    }
    
    public void setWeek4(int week4)
    {
        this.week4 = week4;
    }
    public int getWeek5()
    {
        return week5;
    }
    
    public void setWeek5(int week5)
    {
        this.week5 = week5;
    }
    public int getWeek6()
    {
        return week6;
    }
    
    public void setWeek6(int week6)
    {
        this.week6 = week6;
    }
    public int getWeek7()
    {
        return week7;
    }
    
    public void setWeek7(int week7)
    {
        this.week7 = week7;
    }
    public int getWeek8()
    {
        return week8;
    }
    
    public void setWeek8(int week8)
    {
        this.week8 = week8;
    }
    public int getWeek9()
    {
        return week9;
    }
    
    public void setWeek9(int week9)
    {
        this.week9 = week9;
    }
    public int getWeek10()
    {
        return week10;
    }
    
    public void setWeek10(int week10)
    {
        this.week10 = week10;
    }
    public int getWeek11()
    {
        return week11;
    }
    
    public void setWeek11(int week11)
    {
        this.week11 = week11;
    }
    public int getWeek12()
    {
        return week12;
    }
    
    public void setWeek12(int week12)
    {
        this.week12 = week12;
    }
    
    public int getWeek13()
    {
        return week13;
    }
    
    public void setWeek13(int week13)
    {
        this.week13 = week13;
    }
    
    
    //added by kumar
    private ArrayList m_lotList = new ArrayList();
    public ArrayList getLotList() {
        return m_lotList;
    }
    public void setLotList (ArrayList lotList) {
        m_lotList = lotList;
    }
    
    public void setLotDetails (LotQuantity lot) {
        m_lotList.add (lot);
    }
}
